#include "next_graph.h"

using namespace Graph_lib;

Smiley::Smiley(Point p, int rr):Circle(p,rr){}

void Smiley::draw_lines() const{
    if (color().visibility()){
        int r  = radius();
        int sr = r/5;
        int x0 = point(0).x;
        int y0 = point(0).y;
        fl_arc(x0,y0,r+r,r+r,0,360);
        fl_arc(x0+r/2,y0+r/2,sr,sr,0,360);
        fl_arc(x0+r+r/2-sr,y0+r/2,sr,sr,0,360);
        fl_arc(x0+sr,y0+sr,
                (r-sr)*2,
                (r-sr)*2,210,330);
    }
}


Frowney::Frowney(Point p, int rr):Circle(p,rr){}

void Frowney::draw_lines() const{
    if (color().visibility()){
        int r  = radius();
        int sr = r/5;
        int x0 = point(0).x;
        int y0 = point(0).y;
        fl_arc(x0,y0,r+r,r+r,0,360);
        fl_arc(x0+r/2,y0+r/2,sr,sr,0,360);
        fl_arc(x0+r+r/2-sr,y0+r/2,sr,sr,0,360);
        fl_arc(x0+sr,y0+r,
                (r-sr)*2,
                (r-sr)*2,30,150);
    }
}


Smiley_in_hat::Smiley_in_hat(Point p, int rr):Smiley(p,rr){}


void Smiley_in_hat::draw_lines() const{
    if (color().visibility()){
        int r  = radius();
        int sr = r/5;
        int dx = r/3;
        int dy = r/2;
        int x0 = point(0).x;
        int y0 = point(0).y;

        fl_arc(x0,y0,r+r,r+r,145,35);

        fl_arc(x0-dx,y0-dy,2*(r+dx),2*dy,108,72);
        fl_line(x0+r/2,y0,x0+r/4*3,y0-r);
        fl_line(x0+3*r/2,y0,x0+5*r/4,y0-r);
        fl_arc(x0+3*r/4,y0-9*r/8,r/2,r/4,0,360);
        fl_arc(x0+r/2,y0-r/4,r,r/2,180,0);

        fl_arc(x0+r/2,y0+r/2,sr,sr,0,360);
        fl_arc(x0+r+r/2-sr,y0+r/2,sr,sr,0,360);
        fl_arc(x0+sr,y0+sr,
                (r-sr)*2,
                (r-sr)*2,210,330);
    }
}

Frowney_in_hat::Frowney_in_hat(Point p, int rr):Frowney(p,rr){}


void Frowney_in_hat::draw_lines() const{
    if (color().visibility()){
        int r  = radius();
        int sr = r/5;
        int dx = r/3;
        int dy = r/2;
        int x0 = point(0).x;
        int y0 = point(0).y;

        fl_arc(x0,y0,r+r,r+r,145,35);

        fl_arc(x0-dx,y0-dy,2*(r+dx),2*dy,108,72);
        fl_line(x0+r/2,y0,x0+r/4*3,y0-r);
        fl_line(x0+3*r/2,y0,x0+5*r/4,y0-r);
        fl_arc(x0+3*r/4,y0-9*r/8,r/2,r/4,0,360);
        fl_arc(x0+r/2,y0-r/4,r,r/2,180,0);

        fl_arc(x0+r/2,y0+r/2,sr,sr,0,360);
        fl_arc(x0+r+r/2-sr,y0+r/2,sr,sr,0,360);
        fl_arc(x0+sr,y0+r,
                (r-sr)*2,
                (r-sr)*2,30,150);
    }
}
